package chatin.client;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class ChangerView {
    public static int LOGIN = 0;
    public static int CONTACTLIST = 1;
    private static JPanel views[] = {new LoginUI(), new ContactListUI()};
    private static int currentView = 0;
    private static JFrame jFrame;

    private ChangerView() {
    }

    public static void setMainFrame(JFrame jf) {
        jFrame = jf;
        views[currentView].setVisible(true);
        jFrame.add(views[currentView]);
        jFrame.repaint();
    }

    public static void changeView(int i) {
        jFrame.remove(views[currentView]);
        currentView = i;
        jFrame.add(views[currentView]);
        views[currentView].setVisible(true);
        jFrame.repaint();
    }

    public static JFrame getJFrame() {
        return jFrame;
    }
}